/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "DOCUMENTO_PAGO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DocumentoPago.findAll", query = "SELECT d FROM DocumentoPago d"),
    @NamedQuery(name = "DocumentoPago.findByDocpCod", query = "SELECT d FROM DocumentoPago d WHERE d.docpCod = :docpCod")})
public class DocumentoPago implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "DOCP_COD")
    private String docpCod;
    @OneToMany(mappedBy = "docpCod", fetch = FetchType.LAZY)
    private List<IngresoEgreso> ingresoEgresoList;

    public DocumentoPago() {
    }

    public DocumentoPago(String docpCod) {
        this.docpCod = docpCod;
    }

    public String getDocpCod() {
        return docpCod;
    }

    public void setDocpCod(String docpCod) {
        this.docpCod = docpCod;
    }

    @XmlTransient
    public List<IngresoEgreso> getIngresoEgresoList() {
        return ingresoEgresoList;
    }

    public void setIngresoEgresoList(List<IngresoEgreso> ingresoEgresoList) {
        this.ingresoEgresoList = ingresoEgresoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (docpCod != null ? docpCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DocumentoPago)) {
            return false;
        }
        DocumentoPago other = (DocumentoPago) object;
        if ((this.docpCod == null && other.docpCod != null) || (this.docpCod != null && !this.docpCod.equals(other.docpCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.DocumentoPago[ docpCod=" + docpCod + " ]";
    }
    
}
